<template>
    <div>
        <i-table border stripe  :columns="format" :data="show_list">
            <!-- <template slot-scope="{ row, index }" slot="action">
                    <Button type="error" size="default"  @click="del_cronjob(index)">删除</Button>
            </template> -->
        </i-table >
    </div>
</template>

<script>

import {k8s_namespace_post} from '@/api/http'
import { get_cronjob_list} from  '@/api'


export default {
    data() {
        return {
            format: [
                {
                    title: '名字',key: 'name'
                },
                {
                    title: '命名空间',key: 'namespace'
                },
                {
                    title: '执行周期',key: 'schedule'
                },
                {
                    title: '状态',key: 'status',width:400,
                    render: (h, params) => {
                        return h('div', [
                            h('pre', JSON.stringify(params.row.status,undefined,4))
                        ]);
                    }
                },
                {
                    title: '标签',key: 'labels',width:550,
                    render: (h, params) => {
                        return h('div', [
                            h('pre', JSON.stringify(params.row.labels,undefined,4))
                        ]);
                    }
                },
                {
                    title: '保留job历史数量',key: 'successful_jobs_history_limit'
                },
                {
                    title: 'suspend',key: 'suspend'
                },
                {
                    title: '创建时间',key: 'create_time'
                },
                // {
                //     title: '操作',slot: 'action',align: 'center'
                // }
            ],
            show_list: [],
        }
    },
    methods: {
        refresh() {
            k8s_namespace_post(get_cronjob_list).then( (response) => {
                this.show_list = response.data
            })
        },
    },
    mounted: function() {
        setTimeout(() =>{
            this.refresh();
        },200); 
    }
}
</script>
<style scoped>

</style>